package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailPermissionBean;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailPermissionBean.DetailPermissionItemBean;
import com.huawei.appmarket.service.appdetail.view.widget.DetailPermissionProtocol;
import com.huawei.appmarket.service.appdetail.view.widget.DetailPermissionProtocol.Request;
import com.huawei.appmarket.service.settings.view.widget.EnterLayout;
import java.util.List;
import o.cgz;
import o.cjk;
import o.cjm;
import o.cjo;
import o.ckt;
import o.ewm.j;

public class DetailPermissionGeneralCard extends BaseDistCard implements OnClickListener {
    protected DetailPermissionBean ʽ;
    protected EnterLayout ˋ;
    private List<DetailPermissionItemBean> ॱॱ;

    public /* synthetic */ cgz ˏ(View view) {
        return ॱ(view);
    }

    public DetailPermissionGeneralCard(Context context) {
        super(context);
    }

    public DetailPermissionGeneralCard ॱ(View view) {
        this.ˋ = (EnterLayout) view.findViewById(j.ˋᐣ);
        this.ˋ.setOnClickListener(new ckt(this));
        this.ˋ.setMaxLines(1);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        this.ʽ = (DetailPermissionBean) cardBean;
        if (this.ʽ != null) {
            this.ॱॱ = this.ʽ.ॱ();
            if (this.ॱॱ == null || this.ॱॱ.size() == 0) {
                this.ˋ.setVisibility(8);
            } else if (!ॱ(((DetailPermissionItemBean) this.ॱॱ.get(0)).ˋ())) {
                this.ˋ.setVisibility(8);
            }
        }
    }

    public void onClick(View view) {
        if (view.getId() == j.ˋᐣ) {
            cjo detailPermissionProtocol = new DetailPermissionProtocol();
            Request request = new Request();
            request.ˏ(this.ॱॱ);
            request.ˏ(this.ʽ.v_());
            detailPermissionProtocol.ˎ(request);
            cjk.ˎ().ˋ(view.getContext(), new cjm("detail.permission.activity", detailPermissionProtocol));
        }
    }

    protected boolean ॱ(String str) {
        if (TextUtils.isEmpty(this.ʽ.v_()) || TextUtils.isEmpty(str)) {
            return false;
        }
        this.ˋ.setTitle(this.ʽ.v_());
        this.ˋ.setMemo(str);
        return true;
    }
}
